package avicit.bdp.dgs.standard.dto;

import avicit.bdp.common.base.BaseDTO;
import avicit.bdp.core.enums.DataStateEnum;
import avicit.platform6.core.annotation.log.FieldRemark;
import avicit.platform6.core.annotation.log.LogField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Table;
import javax.persistence.Transient;
import org.apache.commons.lang3.StringUtils;

/**
 * 标准文档表
 *
 * @author mayi
 */
@ApiModel(value = "StandardDocDto", description = "标准文档表")
@Table(name = "bdp_dgs_standard_doc")
public class StandardDocDto extends BaseDTO {

  private static final long serialVersionUID = 1L;

  /** 主键ID */
  @LogField
  @ApiModelProperty(value = "主键")
  @FieldRemark(column = "id", field = "id", name = "主键")
  @Column(name = "id")
  @avicit.platform6.core.annotation.log.Id
  @javax.persistence.Id
  private String id;

  /** 所属分类 */
  @LogField
  @ApiModelProperty(value = "所属分类", name = "typeId")
  @FieldRemark(column = "type_id", field = "typeId", name = "所属分类")
  private String typeId;

  /** 文件编号 */
  @LogField
  @ApiModelProperty(value = "文件编号", name = "code")
  @FieldRemark(column = "code", field = "code", name = "文件编号")
  private String code;

  /** 文件名称 */
  @LogField
  @ApiModelProperty(value = "文件名称", name = "name")
  @FieldRemark(column = "name", field = "name", name = "文件名称")
  private String name;

  /** 存储路径 */
  @LogField
  @ApiModelProperty(value = "存储路径", name = "filePath")
  @FieldRemark(column = "filePath", field = "file_path", name = "存储路径")
  private String filePath;

  /**
   * 状态
   *
   * @see DataStateEnum
   */
  @LogField
  @ApiModelProperty(value = "状态", name = "status")
  @FieldRemark(column = "status", field = "status", name = "状态")
  private Integer status;

  /** 文件说明 */
  @LogField
  @ApiModelProperty(value = "文件说明", name = "remark")
  @FieldRemark(column = "remark", field = "remark", name = "文件说明")
  private String remark;

  @ApiModelProperty(value = "状态")
  @Transient
  private String statusString;

  @ApiModelProperty(value = "分类名称")
  @Transient
  private String typeName;

  public String getId() {
    return id;
  }

  public void setId(String id) {
    this.id = id;
  }

  public String getCode() {
    return code;
  }

  public void setCode(String code) {
    this.code = code;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public String getTypeId() {
    return typeId;
  }

  public void setTypeId(String typeId) {
    this.typeId = typeId;
  }

  public Integer getStatus() {
    return status;
  }

  public void setStatus(Integer status) {
    this.status = status;
  }

  public String getRemark() {
    return remark;
  }

  public void setRemark(String remark) {
    this.remark = remark;
  }

  public String getStatusString() {
    return statusString;
  }

  public void setStatusString(String statusString) {
    this.statusString = statusString;
  }

  public String getTypeName() {
    return typeName;
  }

  public void setTypeName(String typeName) {
    this.typeName = typeName;
  }

  public String getFilePath() {
    return filePath;
  }

  public void setFilePath(String filePath) {
    this.filePath = filePath;
  }

  @Override
  public String getLogFormName() {
    if (StringUtils.isEmpty(super.logFormName)) {
      return "数据标准-标准文档模块";
    } else {
      return super.logFormName;
    }
  }

  @Override
  public String getLogTitle() {
    if (StringUtils.isEmpty(super.logTitle)) {
      return "标准文档";
    } else {
      return super.logTitle;
    }
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    StandardDocDto that = (StandardDocDto) o;
    return Objects.equals(getId(), that.getId())
        && Objects.equals(getCode(), that.getCode())
        && Objects.equals(getName(), that.getName())
        && Objects.equals(getTypeId(), that.getTypeId())
        && Objects.equals(getStatus(), that.getStatus())
        && Objects.equals(getRemark(), that.getRemark());
  }

  @Override
  public int hashCode() {
    return Objects.hash(getId(), getCode(), getName(), getTypeId(), getStatus(), getRemark());
  }
}
